package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.domain.Grogshop;
import cn.wolfcode.trip.base.domain.OrderForm;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IOrderFormService;
import cn.wolfcode.trip.base.util.JsonResult;
import cn.wolfcode.trip.base.util.UploadUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 *酒店管订单
 */
@Controller
@RequestMapping("orderForm")
public class OrderFormController {
    @Autowired
    private IOrderFormService orderFormService;

    @RequestMapping("list")
    public String list(@ModelAttribute("qo")QueryObject qo, Model model){
        model.addAttribute("pageInfo",orderFormService.query(qo));
        return "orderForm/list";
    }

    @RequestMapping("saveOrUpdate")
    @ResponseBody
    public JsonResult saveOrUpdate( OrderForm grogshop){
        JsonResult jsonResult = new JsonResult();
        orderFormService.saveOrUpdate(grogshop);
        return  jsonResult;
    }

    //修改客户状态
    @RequestMapping("/updateStatus")
    //转成json字符串
    @ResponseBody
    public JsonResult updateStatus(Long id,Integer state){
        orderFormService.updateStatus(id,state);
        return new JsonResult();
    }
}
